function Person(name){
    this.name = name;
}

Person.prototype.walk = function(){
    console.log(this.name, "is working");
}

function myNew(constructor, ...rest) {
    const obj = Object.create(constructor.prototype);
    constructor.apply(obj, rest);
    return obj;
}

const p1 = myNew(Person, "eric");
